<template>
  <el-row class="menu_page">
    <el-col>
      <el-menu
        class="el-menu-vertical-demo"
        background-color="#fffedef8"
        text-color="rgb(0, 0, 0)"
        active-text-color="rgb(1, 1, 1)"
      >
        <router-link to="/home">
          <el-menu-item index="0">
            <i class="fa fa-margin fa-server"></i>
            <span slot="title">首页</span>
          </el-menu-item>
        </router-link>
        <el-tooltip
          class="item"
          effect="dark"
          content="修炼"
          placement="right-start"
        >
          <router-link to="/gym">
            <el-menu-item index="1">
              <i class="fa fa-margin fa fa-pied-piper-alt"></i>
              <span slot="title">修炼</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <el-tooltip
          class="item"
          effect="dark"
          content="背包"
          placement="right-start"
        >
          <router-link to="/bag">
            <el-menu-item index="2">
              <i class="fa fa-margin fa fa-shopping-bag"></i>
              <span slot="title">背包</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <el-tooltip
          class="item"
          effect="dark"
          content="门派"
          placement="right-start"
        >
          <router-link to="/school">
            <el-menu-item index="2">
              <i class="fa fa-margin fa fa-universal-access"></i>
              <span slot="title">门派</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <el-tooltip
          class="item"
          effect="dark"
          content="地图玩家"
          placement="right-start"
        >
          <router-link to="/playerlist">
            <el-menu-item index="2">
              <i class="fa fa-margin fa fa-user-circle"></i>
              <span slot="title">地图玩家</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <el-tooltip
          class="item"
          effect="dark"
          content="城市地图"
          placement="right-start"
        >
          <router-link to="/citymap">
            <el-menu-item index="3">
              <i class="fa fa-margin fa fa-map-signs"></i>
              <span slot="title">城市地图</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <el-tooltip
          class="item"
          effect="dark"
          content="个人信息"
          placement="right-start"
        >
          <router-link to="/infoshow">
            <el-menu-item index="4">
              <i class="fa fa-margin fa-asterisk"></i>
              <span slot="title">备用页</span>
            </el-menu-item>
          </router-link>
        </el-tooltip>
        <!-- <template v-for="item in items">
          <el-submenu v-if="item.children" :index="item.path" :key="item.path">
            <template slot="title">
              <i :class="'fa fa-margin ' + item.icon"></i>
              <span slot="title">{{ item.name }}</span>
            </template>
            <router-link
              v-for="(citem, cindex) in item.children"
              :to="citem.path"
              :key="cindex"
            >
              <el-menu-item :index="citem.path">
                <span slot="title">{{ citem.name }}</span>
              </el-menu-item>
            </router-link>
          </el-submenu>
        </template> -->
      </el-menu>
    </el-col>
  </el-row>
</template>
<script>
export default {
  name: "left-menu",
  data() {
    return {
      items: [
        {
          icon: "fa-asterisk",
          name: "备用页",
          path: "info",
          children: [{ path: "infoshow", name: "备用页" }],
        },
        {
          icon: "fa-money",
          name: "管理",
          path: "addgoodtype",
          children: [
            { path: "addgoodtypes", name: "加物品类型" },
            { path: "addgood", name: "加物品" },
            { path: "addequipmentstype", name: "加装备类型" },
            { path: "addequipments", name: "加装备" },
          ],
        },
      ],
    };
  },
  methods: {
    getNewUserInfo() {
      this.$store.dispatch("getNewUserInfo"); // 触发actions里的getNewUserInfo函数，调动接口
    },
  },
};
</script>
<style scoped>
.menu_page {
  position: fixed;
  top: 71px;
  left: 0;
  min-height: 100%;
  background: #fffedef8;
  z-index: 99;
}
.el-menu {
  border: none;
}
.fa-margin {
  margin-right: 5px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 180px;
  min-height: 400px;
}
.el-menu-vertical-demo {
  width: 35px;
}
.el-submenu .el-menu-item {
  min-width: 180px;
}

.hiddenDropdown,
.hiddenDropname {
  display: none;
}
a {
  text-decoration: none;
}
</style>

